from django.db import models


from django.contrib.auth.models import AbstractUser
# Create your models here.

from django.contrib.sites.models import Site


class UserProfile(AbstractUser):
    name = models.CharField(max_length=120,verbose_name="姓名",help_text="用户姓名")
    image= models.ImageField(upload_to="user/images/%Y/%m/%d",verbose_name="头像",help_text="头像")
    def __str__(self):
        return self.username

    class Meta:
        verbose_name="管理人员设置"
        verbose_name_plural=verbose_name

class SiteProfile(models.Model):
    site = models.OneToOneField(Site,related_name="rel_site")
    port = models.IntegerField(verbose_name="端口",default=8000)
    header = models.CharField(max_length=40,verbose_name="网站标题",default="网站标题")
    footer = models.CharField(max_length=40,verbose_name="网站页脚",default="网站页脚")

    def __str__(self):
        return self.site.domain

    class Meta:
        verbose_name="参数设置（必须）"
        verbose_name_plural=verbose_name